import axios from 'axios'
import { getToken } from './localStorage'

const request = axios.create({
  baseURL: 'https://likede2-admin.itheima.net/likede/'
})
request.interceptors.request.use(config => {
  config.headers.Authorization = getToken()
  return config
},
function (err) {
  console.log('err :>> ', err)
  return Promise.reject(err)
})
request.interceptors.response.use(function (response) {
  // console.log('response :>> ', response)
  return response
}, function (err) {
  // console.log('err :>> ', err)
  return Promise.reject(err)
})

export default request
